#include "my_task.h"
#include "cmsis_os.h"
#include "led_watchdog.h"
#include "air724.h"

//sys_led_task
#define TASK1_STK_SIZE		128
void sys_led_task(void *pdata);
osThreadDef(sys_led_task, osPriorityAboveNormal, 1, TASK1_STK_SIZE);

#define MQTT_TASK_STK_SIZE		256
void mqtt_task(void *pdata);
osThreadDef(mqtt_task, osPriorityAboveNormal, 1, MQTT_TASK_STK_SIZE);


void sys_led_task(void *pdata)
{
    while(1)
    {
        sys_led_toggle();
        osDelay(200);
    }
}




void mqtt_task(void *pdata)
{
    air724_sal_init(HAL_UART_PORT_2);
    while(1)
    {
        osDelay(1000);
    }
}


void create_task(void)
{
    osKernelInitialize(); //TOS Tiny kernel initialize
    osThreadCreate(osThread(sys_led_task), NULL);// Create sys_led_task
    osThreadCreate(osThread(mqtt_task), NULL);// Create task2
    osKernelStart();//Start TOS Tiny
}